<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:c="livcos.org/ns/cosmos"
  xmlns:f="livcos.org/ns/xslt/function"
  xmlns="http://www.w3.org/1999/xhtml"
  exclude-result-prefixes="c f">
	
	<xsl:import href="../../common/base.xsl"/>
	<xsl:import href="../style/web.xsl"/>
	
  <xsl:template match="/">
 		<xsl:variable name="url" select="resolve-uri($jobObject/c:request/@context-path, $jobObject/c:request/url)"/>
  	<html>
  		<head>
  			<title>LivCos Tools</title>
  			<style type="text/css">
  				html {
  					background-color: gray;
  					font-family: Verdana, Arial, Helvetica, sans-serif;
  				}
  				div {
  					max-width: 600px;
  					margin: 5% auto;
  					background-color: white;
  					padding: 20px 40px;
  				}
  				a {
  					text-decoration: none;
  					color: #000000;
  					background-color: #DDDDDD;
  					background-image: url("<xsl:value-of select="f:caller-uri(resolve-uri('../img/file.png'))"/>");
  					background-position: left center;
  					background-repeat: no-repeat;
  					padding: 2px 4px 2px 18px;
  					font-size: 14px;
  					font-style: normal;
  				}
  			</style>
  			<script>
  				function installSearchEngine() {
	  				if (window.external &amp;&amp; window.external.AddSearchProvider)
	  					window.external.AddSearchProvider("<xsl:value-of select="$url"/>/livcos.org/web/admin/openSearch.xml");
	  				else
	  					alert("No search engine support");
  				}
  			</script>
  		</head>
  		<body>
  			<div>
  				<h3>LivCos Search</h3>
  				<p>You can add the LivCos search engine to your browser:</p>
  				<p>
  					<input type="button" onclick="installSearchEngine()" value="Install Search Engine"/>
  				</p>
  			</div>
  			<div>
  				<h3>LivCos Clipboard Job</h3>
  				<p>This job allows to copy a text selection within the Web browser as a citation into the LivCos clipboard.</p>
  				<p>Simply drag this bookmarklet into your bookmark toolbar:</p>
  				<p>
  					<xsl:variable name="code">
  						<xsl:text>javascript:(function(){</xsl:text>
  						<xsl:text>var a=window,d=document,e=encodeURIComponent</xsl:text>
  						<xsl:text>,s=getSelection(),n=s.anchorNode;while(n){if(n.id)break;n=n.parentNode;}</xsl:text>
  						<xsl:text>var w=a.open('</xsl:text>
  						<xsl:value-of select="$url"/>
  						<xsl:text>/cb.job?</xsl:text>
  						<xsl:text>u='+e(d.location)+((n)?'&amp;i='+n.id:'')+'&amp;t='+e(d.title)+'&amp;s='+e(s)</xsl:text>
  						<xsl:text>,'cb','width=420,height=230,dialog=1,alwaysRaised=1,centerscreen');</xsl:text>
  						<xsl:text>a.setTimeout(function(){w.focus()},300);</xsl:text>
  						<xsl:text>})()</xsl:text>
  					</xsl:variable>
  					<a href="{$code}">+</a>
  					<xsl:text> </xsl:text>
  					<span style="font-style: italic; font-size:80%">(alternative names: <a href="{$code}">copy</a>, 
  						<a href="{$code}">cp</a>, <a href="{$code}">cb</a>)</span>
  				</p>
  			</div>
  			<div>
  				<h3>LivCos Palettes</h3>
  				<p>A palette is a collection of entities to use as templates for your work. It is a
  					simple document with the chapters shown in a 3-column view.</p>
  				<p>While authoring your documents, you copy an entity (select - Ctrl-C) from the palette
  					and paste it into your work (Ctrl-V).</p>
  				<p><a href="livcos.org/web/palette/palette/doc.html">doc</a></p>
  				<p>We recommend adding your favorit palettes to your browser bookmarks.</p>
  			</div>
  		</body>
  	</html>
  </xsl:template>
  
</xsl:stylesheet>
